package com.wugz.service;

import com.alibaba.dubbo.config.annotation.Service;
import service.IMonitorService;

import java.util.Random;

/**
 * @ClassName MonitorServiceImpl
 * @Description
 * @Author wugz
 * @Date 2020/5/9 16:45
 * @Version 1.0
 */
@Service
public class MonitorServiceImpl implements IMonitorService {
    @Override
    public String testingOne() {

        try {
            Thread.sleep(getRandomSleepTimeMillis());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "I'm testing one service";
    }

    @Override
    public String testingTwo() {
        try {
            Thread.sleep(getRandomSleepTimeMillis());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "I'm testing two service";
    }

    @Override
    public String testingThree() {
        try {
            Thread.sleep(getRandomSleepTimeMillis());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "I'm testing three service";
    }

    private long getRandomSleepTimeMillis() {

        Random random = new Random();
        int i = random.nextInt(100);
        return (long) i;

    }
}
